package kernel.db.basics;


import java.sql.SQLException;
import java.sql.ResultSet;

public class Inscription extends DBOperator{

	/* ############################### Fields ############################### */
	private int IdInscription;

	private Faluchard IdFaluchard;

	private Necessitepiece IdTypeInscription;

	/* ############################### Getters ############################## */
	public int getIdInscription(){
		return IdInscription;
	}

	public Faluchard getIdFaluchard(){
		return IdFaluchard;
	}

	public Necessitepiece getIdTypeInscription(){
		return IdTypeInscription;
	}

	/* ############################### Setters ############################## */
	public void setIdInscription(int newValue){
		this.IdInscription = newValue;
	}

	public void setIdFaluchard(Faluchard newValue){
		this.IdFaluchard = newValue;
	}

	public void setIdTypeInscription(Necessitepiece newValue){
		this.IdTypeInscription = newValue;
	}

	/* ########################### CLASS CONSTRUCTORS ####################### */
	public Inscription(int IdFaluchard,int IdTypeInscription) throws SQLException {
		this.IdFaluchard = IdFaluchard;
		this.IdTypeInscription = IdTypeInscription;
		this.IdInscription = executeUpdate("INSERT INTO inscription VALUES('DEFAULT','"+IdFaluchard+"','"+IdTypeInscription+"')");
	}

	public Inscription(int IdInscription) throws SQLException {
		ResultSet rs = executeSelect("SELECT * FROM inscription WHERE IdInscription='"+IdInscription+"'");
				this.IdInscription = rs.getInt(IdInscription);

	}
}